Record node names for debug output
authorMatthias Clasen <mclasen@redhat.com>
Sun, 3 Sep 2017 15:29:29 +0000 (11:29 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 3 Sep 2017 15:32:09 +0000 (11:32 -0400)
This is useful for GSK_NOTE output as well.

gsk/gskdebugprivate.h
gtk/gtkwidget.c

index 5a3f58d1500b072b197f6cc53ce091d63fc51d55..0f82c80586f8168f2188c501ef3af039bee8a881 100644 (file)
@@ -17,6 +17,8 @@ typedef enum {
   GSK_DEBUG_FALLBACK    = 1 << 8
 } GskDebugFlags;
 
+#define GSK_DEBUG_ANY ((1 << 9) - 1)
+
 typedef enum {
   GSK_RENDERING_MODE_GEOMETRY       = 1 << 0,
   GSK_RENDERING_MODE_SHADERS        = 1 << 1,
index b2e13dfb3d784a43d93ee14e857b2eb5659aa00d..9042af9cb70c0ff483d1028ac9f2f82bccec76cf 100644 (file)
@@ -73,6 +73,7 @@
 #include "gtkrenderbackgroundprivate.h"
 #include "gtkcssshadowsvalueprivate.h"
 #include "gtkdebugupdatesprivate.h"
+#include "gsk/gskdebugprivate.h"
 
 #include "inspector/window.h"
 
@@ -15223,6 +15224,13 @@ gtk_widget_snapshot (GtkWidget   *widget,
     gtk_snapshot_pop (snapshot);
 }
 
+static gboolean
+should_record_names (GtkWidget *widget)
+{
+  return gtk_inspector_is_recording (widget) ||
+         gsk_check_debug_flags (GSK_DEBUG_ANY);
+}
+
 void
 gtk_widget_render (GtkWidget            *widget,
                    GdkWindow            *window,
@@ -15247,7 +15255,7 @@ gtk_widget_render (GtkWidget            *widget,
 
   gtk_snapshot_init (&snapshot,
                      renderer,
-                     gtk_inspector_is_recording (widget),
+                     should_record_names (widget),
                      clip,
                      "Render<%s>", G_OBJECT_TYPE_NAME (widget));
   cairo_region_destroy (clip);